package com.xxx.forward;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @version v1.0
 * @Description:
 * @Author zhanzhongxin
 * @Date 2021/8/4 10:28
 * @Copyright 博为峰
 */
public class ServletDemo01 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("ServletDemo01");
        final RequestDispatcher dispatcher = req.getRequestDispatcher("/f02");
//        dispatcher.forward(req, resp);
        dispatcher.include(req, resp);
        resp.setHeader("f01", "f01");
        resp.getWriter().write("f01");
    }
}
